import { http } from "@/utils/http";

export interface InsertContentTopic {
  name: string;
  desc: string;
  backendImg: string;
  topicType: number;
  isEnable: number;
}

export interface UpdateContentTopicById {
  id: number;
  name: string;
  desc: string;
  backendImg: string;
  topicType: number;
  isEnable: number;
}

export interface RemoveContentTopicById {
  contentId: number;
}

export interface EnableContentTopicById {
  id: number;
  enable: number;
}

export interface QueryContentTopicById {
  topicId: number;
}

export interface ContentTopicVO {
  id: number;
  name: string;
  desc: string;
  backendImg: string;
  topicType: number;
  isEnable: number;
  seeCount: number;
  joinCount: number;
  contentCount: number;
  createUser: string;
  lastUpdateUser: string;
}

export interface ContentTopicBaseVO {
  id: number;
  name: string;
  backendImg: string;
  topicType: number;
  isEnable: number;
  seeCount: number;
  joinCount: number;
  contentCount: number;
  createUser: string;
}

export interface QueryContentTopicByCondition {
  id: number;
  name: string;
  topicType: number;
  isEnable: number;
  createUser: string;
}

//新增内容话题信息
export const insertContentTopicApi = (data: InsertContentTopic) => {
  return http.request<BizResponse<boolean>>(
    "post",
    "/content/topic/insertContentTopic",
    {
      data
    }
  );
};

//更新内容话题信息
export const updateContentTopicByIdApi = (data: UpdateContentTopicById) => {
  return http.request<BizResponse<boolean>>(
    "post",
    "/content/topic/updateContentTopicById",
    {
      data
    }
  );
};

//删除内容话题信息
export const removeContentTopicByIdApi = (data: RemoveContentTopicById) => {
  return http.request<BizResponse<boolean>>(
    "post",
    "/content/topic/removeContentTopicById",
    {
      data
    }
  );
};

//启禁用内容话题信息
export const enableContentTopicByIdApi = (data: EnableContentTopicById) => {
  return http.request<BizResponse<boolean>>(
    "post",
    "/content/topic/enableContentTopicById",
    {
      data
    }
  );
};

//查询内容话题信息详情
export const queryContentTopicByIdApi = (data: QueryContentTopicById) => {
  return http.request<BizResponse<ContentTopicVO>>(
    "post",
    "/content/topic/queryContentTopicById",
    {
      data
    }
  );
};

//多条件查询内容话题信息
export const queryContentTopicByConditionApi = (
  data: QueryContentTopicByCondition
) => {
  return http.request<BizResponse<BizPageResult<ContentTopicBaseVO>>>(
    "post",
    "/content/topic/queryContentTopicByCondition",
    {
      data
    }
  );
};
